<?php
namespace app\admin\controller;
// use think\Controller;
use think\Db;
use think\Request;
use think\Cache;
use think\Cookie;
use think\Session;
use think\captcha\Captcha;
use \app\admin\model\Users as m;
class Ajax extends Common
{
    //多图删除
    public function morephotodel()
    {
        $id=input('id',0);
        $v=Db::name("photo")->find($id);
        if(Db::name("photo")->delete($id)){
            if(file_exists(substr($v['img1'],1))){
                unlink(substr($v['img1'],1));
            }
            $return_data['status'] = 0;
            $return_data['msg'] ="删除成功";
        }else{
            $return_data['status'] = 1;
            $return_data['msg'] ="删除失败";
        }

        echo json_encode($return_data);



    }

    //多图删除未提交
    public function morephotodel1()
    {
        $img=$_POST['img'];
        if(file_exists(substr($img,1))){
            if(unlink(substr($img,1))) {
                $return_data['status'] = 0;
                $return_data['msg'] ="删除成功";
            }else {
                $return_data['status'] = 1;
                $return_data['msg'] ="删除失败";
            }
        }else{
            $return_data['status'] = 1;
            $return_data['msg'] ="图片不存在";
        }

        echo json_encode($return_data);



    }


}